class MinStack {
    constructor() {
        this.length = 0;
        this.content = [];
        this.mins = [];
    }
    push(val) {
        const curMin = this.mins[this.length - 1] !== undefined ? this.mins[this.length - 1] : Infinity;
        this.content[this.length++] = val;
        this.mins[this.length - 1] = Math.min(curMin, val);
    }
    pop() {
        return this.content[--this.length];
    }
    top() {
        return this.content[this.length - 1];
    }
    getMin() {
        return this.mins[this.length - 1];
    }
}